package l.l.w.携程.题目2;

import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by llw on 2018/3/29/0029.
 */
public class Main {
    public static void main(String[] args) {
        int n = 0;
        Scanner scanner = new Scanner(System.in);
        String a = scanner.nextLine();
        String c = a.replaceAll("\\s", " ");
        String b = c.trim();

        String[] strs = c.split(" ");
//        int temp
       for(int i =0;i < strs.length; ++i){
           try {
               int temp  = Integer.valueOf(strs[i]);
           }catch (Exception e){

           }
       }
        n = strs.length;
        int[][] nums = new int[n][n];
        for(int i = 0; i < n; ++i){
            if(!"".equals(strs[i]))
                nums[0][i] = Integer.valueOf(strs[i]);
        }
        for(int i = 1; i < n; ++i){
            for(int j = 0; j < n; ++j){
                nums[i][j] = scanner.nextInt();
            }
        }
        System.out.println(Arrays.toString(nums));

        int istart = 0, iend = n -1, jstart = 0, jend = n -1;
        while (istart < iend){
            for(int i = istart; i <= iend; ++i){
                int t = nums[istart][i];
                nums[istart][i] = nums[i][jstart];
                nums[i][jstart] = nums[iend][i];
                nums[iend][i] = nums[i][jend];
                nums[i][jend] = t;
            }
            jstart--;jstart++;istart++;iend--;
        }
        for(int i = 0; i < n; ++i){
            for(int j = 0; j < n; ++j){
                System.out.print(nums[i][j] + " ");
            }
            System.out.println();
        }
    }
}
